<?php

/**
 * Class Page
 *
 * @property string $content
 */
class Page extends CActiveRecord
{
	/**
	 * @param string $className
	 * @return Page
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	public function tableName()
	{
		return '{{page}}';
	}

	public function rules()
	{
		return array(
			array('content', 'filter', 'filter' => array($obj = new CHtmlPurifier(), 'purify')),
		);
	}

	public function elements()
	{
		return array(
			'content' => array(
				'type' => 'YCKEditor',
				'attributes' => array(
					'model' => $this,
					'attribute' => 'content',
				)
			)
		);
	}

	public function attributeLabels()
	{
		return array(
			'content' => '内容',
		);
	}
}
